<template>
  <!-- 维修详情 -->
  <div v-if="list && list.length">
    <!-- 报修人查看维修详情 -->
    <div v-for="item in list" :key="item.id">
      <FourLine />
      <div class="detail-repairor">
        <div class="title">维修/处理人员</div>
        <div class="name">
          <span v-if="item.person_name">{{ item.person_name }}</span>
          <span v-else>-</span>
          <span class="tel" @click="telPhone(item.person_mobile)">
            <span v-if="item.person_mobile">{{ item.person_mobile }}</span>
            <span v-else>-</span>
            <svg-icon icon-class="mobile" />
          </span>
        </div>
      </div>
      <FourLine />
      <div class="detail-repairInfo">
        <div>
          <span class="title">维修/处理详情</span>
          <span class="time">{{
            dayjs(item.create_time).format("YYYY-MM-DD hh:mm")
          }}</span>
        </div>
        <div>
          <div class="content">
            {{ item.repair_desc }}
          </div>
          <PreviewComp
            :imgList="
              item.equipmentRepairResultFiles
                .filter((i) => isImage(i.url))
                .map((k) => k.url)
            "
            :videoList="
              item.equipmentRepairResultFiles
                .filter((i) => !isImage(i.url))
                .map((k) => k.url)
            "
          />
        </div>
      </div>
    </div>
  </div>
  <div v-else>
    <FourLine />
    <div class="detail-repairor">
      <div class="title">维修/处理人员</div>
      <div class="name">
        <span>-</span>
        <span class="tel">
          <span>-</span>
          <svg-icon icon-class="mobile" />
        </span>
      </div>
    </div>
    <FourLine />
    <div class="detail-repairInfo">
      <div>
        <span class="title">维修/处理详情</span>
        <span class="time"></span>
      </div>
      <EmptyComp />
      <!-- <DialogPhone ref="phoneRef" /> -->
    </div>
  </div>
</template>
<script lang="ts" setup>
import EmptyComp from "./empty.vue";
import FourLine from "./FourLine.vue";
import * as dayjs from "dayjs";
// import { onMounted } from "vue";
import { isImage } from "@/utils/utils";
import PreviewComp from "@/components/previewComp/index.vue";
defineProps({
  list: Array,
});
const telPhone = (phone) => {
  window.location.href = `tel:${phone}`;
};
</script>

<style lang="less" scoped>
.detail-repairor {
  padding: 12px 16px;
  background: #fff;
  .title {
    font-size: 14px;
    line-height: 22px;
    color: #303233;
    font-weight: 600;
  }
  .name {
    margin-top: 10px;
    font-size: 14px;
    line-height: 22px;
    color: #333333;
    display: flex;
    justify-content: space-between;
  }
  .tel {
    color: #3e77fa;
    display: flex;
    align-items: center;
    svg {
      margin-left: 10.7px;
    }
  }
}
.detail-repairInfo {
  padding: 12px 16px;
  background: #fff;
  margin-top: 4px;
  flex: 1;
  > div:first-child {
    display: flex;
    justify-content: space-between;
  }
  .title,
  .time {
    font-size: 14px;
    line-height: 22px;
    color: #303233;
    font-weight: 600;
  }
  .time {
    color: #919599;
  }
  .content {
    font-size: 14px;
    line-height: 32px;
    color: #333333;
    margin-top: 10px;
    margin-bottom: 8px;
  }

  .empty {
    padding-top: 60px;
  }
}
</style>
